package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.mvcframework.annotations.QjcAutowired;
import com.lagou.mvcframework.annotations.QjcController;
import com.lagou.mvcframework.annotations.QjcRequestMapping;
import com.lagou.mvcframework.annotations.QjcSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@QjcController
@QjcRequestMapping("/demo")
public class DemoController {


    @QjcAutowired
    private IDemoService demoService;

    @QjcRequestMapping("/handle01")
    @QjcSecurity({"zhangsan", "lisi"})
    public String handler01(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }

    @QjcRequestMapping("/handle02")
    @QjcSecurity({"zhangsan"})
    public String handler02(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }


    /**
     * URL: /demo/query?name=lisi
     *
     * @param request
     * @param response
     * @param name
     * @return
     */
    @QjcRequestMapping("/query")
    public String query(HttpServletRequest request, HttpServletResponse response, String name) {
        return demoService.get(name);
    }
}
